package com.wzy.netty.nio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * 描述  类型化
 * 创建人    Wzy
 * 创建时间: 2020-05-20  16:09
 */
public class NIOFileChannel04 {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("d:\\a.jpg");
        FileOutputStream fileOutputStream = new FileOutputStream("d:\\b.jpg");

        FileChannel channel1 = fileInputStream.getChannel();
        FileChannel destch = fileOutputStream.getChannel();

        destch.transferFrom(channel1, 0, channel1.size());

        //关闭相关的通道和流
        channel1.close();
        destch.close();
        fileInputStream.close();
        fileOutputStream.close();
    }
}
